<ul class="pagination">
    <li {% if page == 1 %}class="disabled"{% endif %}>
        {% if page != 1 %}
            <a href="{{ request.path }}?current_page={{ page|add:'-1' }}&num_perpage={{ per_page }}" aria-label="Previous">
                <span aria-hidden="true">&laquo;</span>
            </a>
        {% else %}
            <span aria-hidden="true">&laquo;</span>
        {% endif %}
    </li>
    {% for i in page_list %}
        <li {% if i == page %}class="active"{% endif %}><a href="{{ request.path }}?current_page={{ i }}&num_perpage={{ per_page }}">{{ i }}</a></li>
    {% endfor %}
    <li {% if page == total_pages %}class="disabled"{% endif %}>
        {% if page < total_pages %}
            <a href="{{ request.path }}?current_page={{ page|add:'1' }}&num_perpage={{ per_page }}" aria-label="Next">
                <span aria-hidden="true">&raquo;</span>
            </a>
        {% else %}
            <span aria-hidden="true">&raquo;</span>
        {% endif %}
    </li>
</ul>